package com.vancouver.knows.business.tracker;

import java.util.HashMap;

import com.pangu.task.IResultReceiver;
import com.pangu.task.OperateResult;
import com.pangu.task.mark.ATaskMark;
import com.vancouver.knows.business.BusinessModule;
import com.vancouver.knows.business.cache.SearchPostInfoCache;

/**
 * 用户搜索列表
 * 
 * @author llf
 * 
 */
public class UserSearchTracker extends ABInvokeTracker {

	public UserSearchTracker(BusinessModule module, IResultReceiver resultReceiver) {
		super(module, resultReceiver);
	}

	@Override
	protected void handleTaskRefresh(ATaskMark taskMark, OperateResult result) {
		SearchPostInfoCache searchInfoCache = module.getCacheManager().getSearchInfoCache();
		searchInfoCache.deleteItemInfoIndexFromCache(taskMark);
	}

	@Override
	public String TAG() {
		return UserSearchTracker.class.getSimpleName();
	}

	@SuppressWarnings("unchecked")
	@Override
	public void handleResult(OperateResult result) {
		HashMap<String, Object> map = (HashMap<String, Object>) result.getResultData();
		if (map == null)
			return;
		module.getCacheManager().setSearchKeyWorkInfoMap(map);
	}
}
